package com.xwj.validation.nest.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;

/**
 * @Author: xiaowajiang
 * @Date: 2022-03-17 21:07
 * @Description: 学员实体
 **/
@Data
@ApiModel(value = "NestStudentDTO", description = "学员")
public class StudentDTO implements Serializable {
    private static final long serialVersionUID = -2126505372397894307L;

    // 姓名
    @NotBlank(message = "姓名必须填写")
    @ApiModelProperty(value = "姓名", required = true)
    private String name;

    // 课程
    @Valid
    @ApiModelProperty("课程")
    private List<Course> course;

    @Data
    public static class Course {

        @ApiModelProperty(value = "课程编码", required = true)
        @NotBlank(message = "课程编码不能为空")
        private String code;

        @ApiModelProperty(value = "课程名称", required = true)
        @NotBlank(message = "课程名称不能为空")
        @Length(min = 2, max = 10)
        private String name;
    }
}